Search Interview Questions | More than 3000 questions in repository. There are more than 900 unanswered questions. Click here and help us by providing the answer. Have a video suggestion. Click Correct / Improve and please let us know. |
|
| ||||
Core Java - Interview Questions and Answers for 'Data type' - 38 question(s) found - Order By Newest | ||||
| ||||
Ans. There are two types of casting, casting between primitive numeric types and casting between object references. Casting between numeric types is used to convert larger values, such as double values, to smaller values, such as byte values. Casting between object references is used to refer to an object by a compatible class, interface, or array type reference | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   data types   casting  type casting   basic interview question Asked in 8 Companies basic   frequent | ||||
| ||||
Ans. boolean - java.lang.Boolean byte - java.lang.Byte char - java.lang.Character double - java.lang.Double float - java.lang.Float int - java.lang.Integer long - java.lang.Long short - java.lang.Short void - java.lang.Void | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   java5   data types   wrapper classes   adapter design pattern   rare | ||||
| ||||
Ans. They are wrappers to primitive data types. They allow us to access primitives as objects. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   data types   wrapper classes Asked in 3 Companies basic   frequent | ||||
| ||||
Ans. There are 2 reasons for it. 1. Usage of Primitive types - Though Java provides classes for the primitive data types but as the usage of primitives is permissible, its considered unpure OOP's language. 2. Usage of Static members - Static members belong to the class and not objects and hence not considered fit for pure OOP's programming. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  oops  object oriented programming  object oriented language  primitive data types Asked in 2 Companies | ||||
| ||||
Ans. Generalization or UpCasting is a phenomenon where a sub class is prompted to a super class, and hence becomes more general. Generalization needs widening or up-casting. Specialization or DownCasting is a phenomenon where a super class is narrowed down to a sub class. Specialization needs narrowing or down-casting. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   data types   casting  type casting   up casting  type casting   downcasting  type casting   generalization   specialization Asked in 2 Companies | ||||
| ||||
Ans. boolean ---> false byte ----> 0 short ----> 0 int -----> 0 long ------> 0l char -----> /u0000 float ------> 0.0f double ----> 0.0d any object reference ----> null | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   data types   default values | ||||
Try 1 Question(s) Test | ||||
| ||||
Ans. Float can represent up to 7 digits accurately after decimal point, where as double can represent up to 15 digits accurately after decimal point. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   data types   float   double   difference between   basic interview question | ||||
| ||||
Ans. At Application level we use either Double or BigDecimal , preferably BigDecimal. At Database level we use Number with decimal precision 3. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  data types | ||||
| ||||
Ans. They both represent the long primitive type. They are exactly the same. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   data types   long.Class   long.TYPE   advanced expert   rare | ||||
| ||||
Ans. Variables used in a switch statement can only be a byte, short, int, or char ( and String with Java 7 and above ) | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   switch   variable   data type basic   rare | ||||
| ||||
Ans. The default value of the boolean type is false. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   data type   boolean   initialization   default object construction   default constructor   default value | ||||
| ||||
Ans. http://www.buggybread.com/2015/02/java-util-classes-that-inherit-number.html | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   data types   number class | ||||
| ||||
Ans. http://www.buggybread.com/2015/01/java-data-types-double-classes-and_31.html | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   data types   boolean | ||||
| ||||
Ans. http://www.buggybread.com/2015/01/java-data-types-double-classes-and.html | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   data types   double | ||||
| ||||
Ans. http://www.buggybread.com/2015/01/java-data-types-float-classes-and.html | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   data types   float | ||||
| ||||
Ans. http://www.buggybread.com/2015/01/java-data-types-integer-classes-and.html | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   data types   integer | ||||
| ||||
Ans. http://www.buggybread.com/2015/01/java-data-types-long-classes-and.html | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   data types   long | ||||
| ||||
Ans. Data type: a set of values together with operations on that type Data structure: a physical implementation of a data type | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   oops   data structure   data type | ||||
| ||||
Ans. No. Data Type holds data whereas Interface doesn't hold anything. Interface is a contract about how to communicate with the underlying Class. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   interface   data type | ||||
| ||||
Ans. Class can be better seen as Data Type. This could be implemented as a Data Structure too in some cases. One thing worth understanding here is that Data type and Data structure are conceptual things. Class could be implementation of either of these. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   oops   class   data type   data structure | ||||
| ||||
Ans. BigDecimal if memory and Performance is not critical concern, otherwise double. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   data types   double   bigdecimal | ||||
| ||||
Ans. float is a native data type whereas Float is a class. A Float object will always take more memory than float variable as there are metadata overheads with the objects. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   data type   float Asked in 3 Companies basic   frequent | ||||
| ||||
Ans. 64 bit | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   data types | ||||
| ||||
Ans. 64 bit | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   data types | ||||
| ||||
Ans. 16 bit | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   data types | ||||
| ||||
Ans. ADT is a container which holds different types of objects with specifications. For example - Stack, Array, Liked list, Tree | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  data types  abstract data types | ||||
| ||||
Ans. Because the way float values are stored its not precise. For example - 0.1 is actually stored as 0.1000000000000000055511151231257827021181583404541015625 | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  double  float  data type basic   frequent | ||||
| ||||
Ans. It uses those low order bytes of the result that can fit into the size of the type allowed by the operation. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  integer  data types Asked in 1 Companies   rare | ||||
| ||||
Ans. boolean byte char double float int long short void | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  data types  primitive data types Asked in 1 Companies Basic | ||||
| ||||
Ans. Both holds numeric values. short is a 16-bit signed two's complement integer whereas int is a 32-bit signed two's complement integer. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  data types  short vs int | ||||